package com.application.Menu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.application.Balance;
import com.application.PeriodicTable;
import com.application.R;

public class ToolsMenu extends Activity {
    private View.OnClickListener mainListener = new View.OnClickListener() {
        public void onClick(View view) {
            int id = view.getId();
            if (id == R.id.tools_balance) {
                Intent intent = new Intent(ToolsMenu.this, Balance.class);
                startActivity(intent);
            } else if (id == R.id.tools_formula) {
                Intent intent = new Intent(ToolsMenu.this, GasMenu.class);
                startActivity(intent);
            } else if (id == R.id.tools_periodic) {
                Intent intent = new Intent(ToolsMenu.this, PeriodicTable.class);
                startActivity(intent);
            }  else if (id == R.id.tools_cancel) {
                finish();
            }
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initMain();
    }

    private void initMain() {
        setContentView(R.layout.tools_layout);
        findViewById(R.id.tools_balance).setOnClickListener(mainListener);
        findViewById(R.id.tools_formula).setOnClickListener(mainListener);
        findViewById(R.id.tools_cancel).setOnClickListener(mainListener);
        findViewById(R.id.tools_periodic).setOnClickListener(mainListener);
    }
}